<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>已有信息</title>
    <style>
        /* Ensures the page fills the screen and is vertically and horizontally centered */
        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            display: flex;
            justify-content: center; /* Centers horizontally */
            align-items: center; /* Centers vertically */
            background-color: #f9f9f9;
        }

        /* Main container (393px by 853px mobile size) */
        .container {
            width: 393px;
            height: 853px;
            background: #fff;
            border: 1px solid #ccc;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            padding: 20px;
            box-sizing: border-box;
            overflow-y: auto; /* Scrollable content if it exceeds the container height */
        }

        /* Header style */
        .header {
            width: 100%;
            height: 50px;
            background-color: #ddd;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 10px;
            box-sizing: border-box;
        }

        .header h1 {
            margin: 0;
            font-size: 18px;
        }

        .header-button {
            text-decoration: none;
            color: #333;
            font-size: 14px;
            background-color: #ddd;
            padding: 5px 10px;
            border-radius: 4px;
        }

        /* Main content styling */
        .user-info {
            width: 100%;
            margin-bottom: 20px;
        }

        .user-info h3 {
            font-size: 16px;
            margin: 0 0 10px;
            text-align: center;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-bottom: 10px;
            width: 100%;
        }

        .form-group label {
            font-size: 14px;
            margin-bottom: 5px;
        }

        .form-group input {
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 5px;
            width: 100%;
            text-align: center;
            background-color: #f1f1f1;
        }
    </style>
</head>
<body>
    <!-- Container for all content -->
    <div class="container">
        <div class="header">
            <h1>已有信息</h1>
            <a href="/my" class="header-button">返回</a>
        </div>

        <!-- Dynamic content loop -->
        <div class="user-info">
            {% for message in messages %}
            <h3>用户信息 {{ loop.index }}</h3>
            <div class="form-group">
                <label>姓名：</label>
                <input type="text" value="{{ message.name }}" readonly>
            </div>
            <div class="form-group">
                <label>身份证：</label>
                <input type="text" value="{{ message.idcard }}" readonly>
            </div>
            <div class="form-group">
                <label>票型：</label>
                <input type="text" value="{{ message.type }}" readonly>
            </div>
            {% endfor %}
        </div>
    </div>
</body>
</html>
